package com.sun.demo.mvc.action;

import com.sun.demo.service.IDemoService;
import com.sun.spring.annotation.Autowired;
import com.sun.spring.annotation.Controller;
import com.sun.spring.annotation.RequestMapping;
import com.sun.spring.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * create by Sun
 * 2018/8/9
 */
@Controller
@RequestMapping("/demo")
public class DemoAction {
    @Autowired
    private IDemoService demoService;
    @RequestMapping("/query.json")
    public void query(HttpServletRequest req, HttpServletResponse resp,
                      @RequestParam("name") String name){
        String result = demoService.get(name);
        System.out.println(result);
//		try {
//			resp.getWriter().write(result);
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
    }

    @RequestMapping("/edit.json")
    public void edit(HttpServletRequest req,HttpServletResponse resp,Integer id){

    }
}
